package cn.changshengjue.dakong.command.sub;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.scheduler.BukkitRunnable;

import cn.changshengjue.dakong.main;
import cn.changshengjue.dakong.command.SubCommand;
import cn.changshengjue.dakong.command.type.AdminCommand;

public class ItemCommand extends SubCommand implements AdminCommand {
	public ItemCommand() {
		super("item", "/dk item", main.getInstance().getConfig().getString("commands.item"));
	}

	@SuppressWarnings("deprecation")
	@Override
	public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
		Player player = Bukkit.getPlayer(sender.getName());
		if (player.getItemInHand().getType() != null) {
			String replace = player.getItemInHand().toString().replace("ItemStack{", "")
					.replace("x " + player.getItemInHand().getAmount(), "").replace(" ", "")
					.replace("}", "");
			if (replace.contains(",")) {
				String[] split = replace.split(",");
				player.sendMessage(split[0]);
			}else {
				player.sendMessage(replace);
			}
		}
		return false;
	}

	@Override
	public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
		return null;
	}

	public static void main(String[] args) {
		System.out.println(Math.pow(0.01, 10));
	}
}
